package com.guashu.designpatterns.chainresponsibility;

import org.springframework.util.StringUtils;


// ValidateHandler.java

/**
 * 用于进行非空校验。
 */
public class ValidateHandler extends Handler<Member> {

    @Override
    public void doHandler(Member member) {
        if (StringUtils.isEmpty(member.getUserName()) ||
                StringUtils.isEmpty(member.getPassWord())) {
            System.out.println("用户名和密码不能为空");
            return;
        }
        if (null != next) {
            next.doHandler(member);
        }
    }
}
